import { createSlice } from "@reduxjs/toolkit";
import { log } from '../../configs/common'

const RouterSlice = createSlice({
    name: 'router',
    initialState: {
        path: '/login',
        query: {

        }
    },
    reducers: {
        to: (state, action) =>{
            log('navigate content: ',action.payload)
            return {
                ...state,
                path: action.payload.path,
                query: action.payload.query || state.query
            }
        }
    }
})

export const { to } = RouterSlice.actions

export default RouterSlice.reducer